home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / doMergeClipArgList.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  3.4 KB  |  128 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  Nov, 1999
  22. //  Author:         bb
  23. //
  24. //    Procedure Name:
  25. //        doDuplicateClipArgList
  26. //
  27. //    Description:
  28. //        Duplicate a clip
  29. //
  30. //    Input Arguments:
  31. //    $version: The version of this option box.  Used to know how to 
  32. //    interpret the $args array.
  33. //  
  34. //    $args
  35. //    Version 1
  36. //    [0]     $name: name of the baked clip
  37. //  [1]     $editor : editor containing the clip
  38. //  [2]     $keep : 0 = put merged version in trax
  39. //                  1 = put merged version in visor
  40. //
  41. global proc
  42. doMergeClipArgList( string $version, string $args[] )
  43. {
  44.     string $mergeName   = $args[0];
  45.     string $clipEd        = $args[1];
  46.     int    $keep         = $args[2];
  47.  
  48.     if (size($clipEd) == 0) {
  49.         error ("Could not find the clipEditor: " + $clipEd);
  50.         return;
  51.     }
  52.  
  53.     string $cmd;
  54.     string $selectedClips[] = `clipEditor -q -sc $clipEd`;
  55.     string $selectedBlends[] = `clipEditor -q -sb $clipEd`;
  56.  
  57.     int $nClips = `size($selectedClips)`;
  58.     int $nBlends = `size($selectedBlends)`;
  59.  
  60.     if (0 == $nClips && 0 == $nBlends) {
  61.         error("No clips or blends are selected.");
  62.         return;
  63.     }
  64.  
  65.     //    The first thing to check is that the clips and blends all have the 
  66.     //    same scheduler.
  67.     //
  68.     string $scheduler = "";
  69.     int $ii = 0;
  70.     for ($ii = 0; $ii < $nClips; $ii+=2) {
  71.         if ($ii == 0) {
  72.             $scheduler = $selectedClips[0];
  73.             continue;
  74.         }
  75.  
  76.         if ($selectedClips[$ii] != $scheduler) {
  77.             error("All selected clips must be on the same character.");
  78.         }
  79.     }
  80.  
  81.     //    Only the first blend can be passed to the bakeClip command. 
  82.     //    Blends are automatically included when both their clips are selected.
  83.     //
  84.     if ($nBlends > 0) {
  85.         if ($scheduler == "") {
  86.             $scheduler = $selectedBlends[0];
  87.         } else {
  88.             if ($scheduler != $selectedBlends[0]) {
  89.                 error("All selected clips and blends must be on the same character.");
  90.                 return;
  91.             }
  92.         }
  93.     }
  94.  
  95.     //    Create the command.
  96.     //
  97.     string $bakeClipCmd = "bakeClip ";
  98.     string $clipPart = "";
  99.  
  100.     for ($ii = 0; $ii < $nClips; $ii+=2) {
  101.         $clipPart += ("-ci " + $selectedClips[$ii+1] + " ");
  102.     }
  103.  
  104.     $bakeClipCmd += $clipPart;
  105.  
  106.     string $blendPart = "";
  107.     if ($nBlends > 0) {
  108.         $blendPart = 
  109.             ("-b " + $selectedBlends[1] + " " + $selectedBlends[2] + " ");
  110.     }
  111.  
  112.     $bakeClipCmd += $blendPart;
  113.  
  114.     // Check for -keepOriginals toggle
  115.     //
  116.     if ($keep)
  117.         $bakeClipCmd += " -k ";
  118.  
  119.     if ($mergeName != "") {
  120.         $bakeClipCmd += ("-name "+$mergeName+" ");
  121.     }
  122.  
  123.     string $character[] = `clipSchedule -q -ch $scheduler`;
  124.  
  125.     $bakeClipCmd += $character[0];
  126.     eval($bakeClipCmd);
  127. }
  128.